//package com.example.demo.netty;
//
//import io.netty.bootstrap.ServerBootstrap;
//import io.netty.channel.ChannelFuture;
//import io.netty.channel.ChannelHandlerContext;
//import io.netty.channel.ChannelInboundHandlerAdapter;
//import io.netty.channel.ChannelInitializer;
//import io.netty.channel.nio.NioEventLoopGroup;
//import io.netty.channel.socket.SocketChannel;
//import io.netty.channel.socket.nio.NioServerSocketChannel;
//import io.netty.handler.codec.FixedLengthFrameDecoder;
//import io.netty.handler.codec.LineBasedFrameDecoder;
//import io.netty.handler.logging.LoggingHandler;
//
//public class NettyServerTest2 {
//    public static void main(String[] args) {
//        NioEventLoopGroup boss=new NioEventLoopGroup();
//        NioEventLoopGroup worker=new NioEventLoopGroup();
//        try {
//            ServerBootstrap serverBootstrap = new ServerBootstrap()
//                    .channel(NioServerSocketChannel.class)
//                    .group(boss, worker)
//                    .childHandler(new ChannelInitializer<SocketChannel>() {
//                        @Override
//                        protected void initChannel(SocketChannel socketChannel) throws Exception {
////                            socketChannel.pipeline().addLast(new FixedLengthFrameDecoder(10));
//                            socketChannel.pipeline().addLast(new LineBasedFrameDecoder(1024));
//                            socketChannel.pipeline().addLast(new LoggingHandler());
//                        }
//                    });
//            ChannelFuture future = serverBootstrap.bind(8082).sync();
//            future.channel().closeFuture().sync();
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            boss.shutdownGracefully();
//            worker.shutdownGracefully();
//        }
//    }
//}
